var express = require("express");
var router = express.Router();
const { RoomGroup } = require("../models");

/**
 * 查询宿舍楼列表
 */
router.get("/", async (req, res, next) => {
  const result = await RoomGroup.findAll();
  res.send(result);
});

/**
 * 新增宿舍楼
 */
router.post("/", async (req, res, next) => {
  const { groupName } = req.body;
  const result = await RoomGroup.create({
    groupName,
  });
  res.send(result);
});

module.exports = router;
